package question

// 2367. 算术三元组的数目
func arithmeticTriplets(nums []int, diff int) int {
	m := make(map[int]struct{})
	for _, v := range nums {
		m[v] = struct{}{}
	}
	max := 0
	for _, v := range nums {
		_, o := m[v+diff]
		_, k := m[v+diff*2]
		if o && k {
			max++
		}
	}
	return max
}
